/* Copyright (c) 2004-2024 Peigen.info. All rights reserved. */

package info.peigen.hotpot.component.gateway.dianlan.bits;

import info.peigen.hotpot.component.gateway.dianlan.bits.base.BitParserBase;
import info.peigen.hotpot.component.gateway.dianlan.protocol.passive.DianlanDcStubDataGram;

/**
 * <b>(DianlanDcStubForwardDataGramReasonBits)</b>
 * <p>
 * 直流充电时电机报文-解析
 *
 * @author LiDaHai
 * @version 1.0.0
 * @since 2023/1/12
 */
public class DianlanDcStubDataGramReasonBits extends BitParserBase {

    public DianlanDcStubDataGram parseReason(String hexString) {
        String[]              hexStrArray = hexStrToArray(hexString);
        DianlanDcStubDataGram info        = DianlanDcStubDataGram.builder().build();
        info.setTotalChargeTime(parseInt(hexStrArray[1] + hexStrArray[0]) + "");
        info.setTotalChargingEnergy(parseInt(hexStrArray[3] + hexStrArray[2]) + "");
        info.setStubNo(parseInt(hexStrArray[7] + hexStrArray[6] + hexStrArray[5] + hexStrArray[4]) + "");
        return info;
    }
}